#if UNITY_EDITOR
using UnityEditor;
using FibMatrix.Task;

namespace FibMatrix
{
    [FM_Mono.IgnoreGen]
    public class AssetDBLoadAssetPipe : IResourceLoadPipe
    {
        public AssetDBLoadAssetPipe()
        {
        }

        public FMTask Handle(IResourcePipelineContext context, out ResourceError error)
        {
            error = ResourceError.None;

            DefaultLoadItem mainHint = context.item as DefaultLoadItem;

            if (mainHint.assetHandle == null)
            {
                ++mainHint.objRefCount;
                mainHint.assetHandle = new AssetDBUAssetLoadHandle(AssetDatabase.LoadAssetAtPath(mainHint.itemID, context.type ?? typeof(UnityEngine.Object)));
            }
            return null;
        }
    }
}
#endif